home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / FUNC_EX.BAS < prev    next >
BASIC Source File  |  1988-09-20  |  436b  |  17 lines

  1. ' *** FUNC_EX.BAS ***
  2.  
  3. LINE INPUT "Enter a string: ",InString$
  4. PRINT "The string length is"; StrLen(InString$)
  5.  
  6. FUNCTION StrLen(X$)
  7.    IF X$ = "" THEN
  8.       ' The length of a null string is zero.
  9.       StrLen=0
  10.    ELSE
  11.       ' Non-null string--make a recursive call.
  12.       ' The length of a non-null string is 1
  13.       ' plus the length of the rest of the string.
  14.       StrLen=1+StrLen(MID$(X$,2))
  15.    END IF
  16. END FUNCTION
  17.